<template>
  <div class="list">
    <div class="content-head" style="margin-bottom: 20px;">
     
    </div>
    <a-table class="table" :rowKey="row => row.uuid" :dataSource="list" :pagination="pagination" :size="size">
  
      <a-table-column title="日期" width="100px">
        <template slot-scope="row">
          <div>{{row.date}}</div>
        </template>
      </a-table-column>
      <a-table-column title="现金收入" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.xzsr)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="已转账的提现" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.ytx)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="发起的提现" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.fqtx)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="当日发货" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.yfh)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="发起的提货" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.yth)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="现金消耗" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.xjxh)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="红包消耗" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.hbxh)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="积分消耗" width="100px">
        <template slot-scope="row">
          <div>{{row.jfxh}}</div>
        </template>
      </a-table-column>
      <a-table-column title="优惠券消耗" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.yhqxh)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="抽赏红包总值" width="100px">
        <template slot-scope="row">
          <div>{{$tool.formatPrice(row.cshbzz)}}</div>
        </template>
      </a-table-column>
      <a-table-column title="抽赏积分总值" width="100px">
        <template slot-scope="row">
          <div>{{row.csjfzz}}</div>
        </template>
      </a-table-column>
      

    </a-table>

  </div>
</template>
<script>
  import moment from 'moment'
  import ISwitch from '@/components/ISwitch/ISwitch'

  const resourceType = 'revenue'
  const resourceTypeText = '营收记录'

  export default {
    components: {
      ISwitch,
    },
    props: {
      params: {
        type: Object
      },
    },
    data() {
      return {
        resourceTypeText,
        list: [],
        page: 1,
        per_page: 10,
        total: 0,
      }
    },
    watch: {
      params() {
        this.refreshData()
      },
    },
    computed: {
      pagination() {
        return {
          defaultPageSize: this.per_page,
          defaultCurrent: this.page,
          total: this.total,
          onChange: (e) => {
            this.page = e.current
            this.per_page = e.pageSize
            this.fetchData()
          }
        }
      }
    },
    created() {
      this.fetchData()
    },
    methods: {
      refreshData() {
        this.page = 1
        this.key = ''
        this.fetchData()
      },
      fetchData() {
        this.isEdit = false
        this.$http.get(`/${resourceType}`, {
          params: {
            ...this.params,
            page: this.page,
            per_page: this.per_page,
          }
        }).then(res => {
          this.list = res.data.list
          this.total = res.data.item_total
        }).finally(() => {
          this.loading = false
        })

      },
    }
  }
</script>
<style lang="scss" scoped>
  .value-font {
    font-weight: 500;
    font-size: 110%;
  }
  .content-head {
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
  }

  .sort-keys {
    display: flex;
    align-items: center;

    .tab-list {
      display: flex;
      margin-top: 6px;
      border-bottom: 1px solid #e1e1e1;
      margin-right: 50px;

      .item {
        margin-right: 30px;
        padding: 0px 10px 4px 10px;
        cursor: pointer;
        font-weight: 500;

        &.actived {
          color: #1890FF;
          border-bottom: 3px solid #1890FF;
        }

        &:hover {
          color: #1890FF;
        }
      }
    }

  }

  .table {
    .thumb {
      height: 60px;
      border-radius: 6px;
    }

    .content-image {
      height: 60px;
      width: 60px;
      margin-right: 10px;
      margin-bottom: 10px;
      object-fit: cover;
      border-radius: 10px;
      cursor: pointer;

      &:hover {
        opacity: 0.8;
      }
    }

    .user {
      display: flex;
      // flex-wrap: wrap;
      align-items: center;
      img {
        width: 26px;
        height: 26px;
        margin-right: 6px;
        border-radius: 50%;
        overflow: hidden;
      }
      .gender-man, .gender-woman {
        margin-left: 5px;
        font-size: 12px;
      }
      .gender-man {
        color: #409EFF;
      }
      .gender-woman {
        color: #F56C6C;
      }
    }
  }
</style>
